<?php
include_once "checksession.php";
include_once "db.php";
include_once "auth_permissions.php";
authorize('admin');

if (is_numeric($_GET[CT_ID]))
$computers = mysql_query ("SELECT * FROM computer_type WHERE CT_ID = '$_GET[CT_ID]'");
$deactive = $_GET['deactivate'];
$activate = $_GET['activate'];
$hide = $_GET['hide'];
$show = $_GET['show'];

if($deactive == 'true'){
mysql_query("UPDATE computer_type SET status = '1' WHERE computer_type.CT_ID = '$_GET[CT_ID]' LIMIT 1")
or die(mysql_error()); 
	
   header("Location: computers.php");
   }
   if($activate == 'true'){
   mysql_query("UPDATE computer_type SET status = '0' WHERE computer_type.CT_ID = '$_GET[CT_ID]' LIMIT 1") 
	or die(mysql_error()); 
	header("Location: computers.php");
   }
   if ($hide == 'true'){
     mysql_query("UPDATE computer_type SET hidden = '1' WHERE computer_type.CT_ID = '$_GET[CT_ID]' LIMIT 1")
	or die(mysql_error()); 
	
   header("Location: computers.php");
   }
   if ($show == 'true'){
     mysql_query("UPDATE computer_type SET hidden = '0' WHERE computer_type.CT_ID = '$_GET[CT_ID]' LIMIT 1") 
	or die(mysql_error()); 
	header("Location: computers.php");
   }
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Modify Browsers</title>
<link href="meta-style.css" rel="stylesheet" type="text/css" />

</head>

<body>
<?php
include_once "topnav.php";
?>
<p class="title">Edit Computer</p>
<form action="edit_computer.php" method="post">
<table width="700" border="0" cellspacing="2" cellpadding="2">
  <tr><td><?php
    while($results = mysql_fetch_array($computers)) 
   {
     echo  "<INPUT NAME=\"CT_desc\" TYPE=\"TEXT\" VALUE=\"" . $results[CT_desc]. "\"> \n";
	}
	
	?>
   </td>
  </tr>
</table>
<?php
echo "<input name=\"CT_ID\" type=\"hidden\" id=\"CT_ID\" value=\"" . $_GET[CT_ID] ."\"> \n";
?>
<input type=SUBMIT value="Submit" name="SUBMIT">
</form>

 <p><a href="index.php">Back to Main Menu</a></p>
</body>
</html>
